var relRecords = {
	props: ['title','oi_id'],
	data: function() {
		return {
			baseUrl: '/c5b8a1bf96a/public/index.php/admin',
			info: {},
			pos: 1,
			pur_rows: [],
			exp_rows: []
		}
	},
	watch: {
		oi_id: function(){
			this.pos = 1;
			this.getPurList();
		}
	},
	template: `
				<div>
					<ul class="tab" style="width: 200px;">
						<li @click="pos=1;getPurList()" :class="{'li-atv': pos==1}">报单记录</li>
						<li @click="pos=2;getExpList()" :class="{'li-atv': pos==2}">发货记录</li>
					</ul>
					
					<div v-show="pos==1">
						<table style="width:80%" v-if="pur_rows.length>0">
				    		<tr style="color:#aaa">
				    			<th>报单日期</th>
				    			<th>档口</th>
				    			<th>单价</th>
				    			<th>备注</th>
				    			<th>状态</th>
				    		</tr>
				    		<tr v-for="row in pur_rows">
				    			<td>{{ row.add_day }}</td>
				    			<td>{{ row.stall_name }}</td>
				    			<td>{{ row.price }}</td>
				    			<td>{{ row.remarks }}</td>
				    			<td>{{ row.status_txt }}</td>
				    		</tr>
				    	</table>
				    	<div style="color:red;text-align:center" v-else>无报单记录</div>
					</div>
					<div v-show="pos==2">
						<table style="width:80%" v-if="exp_rows.length>0">
				    		<tr style="color:#aaa">
				    			<th>日期</th>
				    			<th>快递公司</th>
				    			<th>物流单号</th>
				    			<th>数量</th>
				    			<th>备注</th>
				    		</tr>
				    		<tr v-for="row in exp_rows">
				    			<td>{{ row.add_day }}</td>
				    			<td>{{ row.exp_name }}</td>
				    			<td>{{ row.exp_no }}</td>
				    			<td>{{ row.qty }}</td>
				    			<td>{{ row.remarks }}</td>
				    		</tr>
				    	</table>
				    	<div style="color:red;text-align:center" v-else>无发货记录</div>
					</div>
				</div>`,
	methods: {
		getExpList: function(){
			var _this = this;
			$.post(this.baseUrl + '/Express/getListByOid',{
				order_item_id: this.oi_id
			}, function(rsp){
				_this.exp_rows = rsp.data.rows;
			},'json')
		},
		getPurList: function(){
			var _this = this;
			$.post(this.baseUrl + '/Purchase/getList',{
				order_item_id: this.oi_id
			}, function(rsp){
				_this.pur_rows = rsp.data.rows;
			},'json')
		}
	}
}